//
//  PayViewController.m
//  Arts1
//
//  Created by Mac Jc on 15/9/26.
//  Copyright © 2015年 Arts1. All rights reserved.
//

#import "PayViewController.h"
#import "AllHeader.h"

// 生成渐变开始颜色
#define kGradientStart [UIColor colorWithRed:230 % 256 / 255.0 green:0 % 256 / 255.0 blue:155 % 256 / 255.0 alpha:1]

// 生成渐变结束颜色
#define kGradientEnd [UIColor colorWithRed:150 % 256 / 255.0 green:10 % 256 / 255.0 blue:155 % 256 / 255.0 alpha:1]


@interface PayViewController ()
//  生成渐变层
@property (strong, nonatomic) CAGradientLayer *gradientLayer;

@end

@implementation PayViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor clearColor];
    
    //  添加模糊背景
//    [UIView viewOfBlurEffect:self.view withAlpha:1.0];

//    UIImageView *screenShotView = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
//    [self.view addSubview:screenShotView];
//    screenShotView.image = [_screenShotImage boxblurImageWithBlur:10];

    
    
    UIView *backgroundView = [[UIView alloc] initWithFrame:CGRectMake(25, SCREEN_HEIGHT / 2 - 220 / 2 - 50, SCREEN_WIDTH - 50, 220)];
    backgroundView.layer.cornerRadius = 15;
    backgroundView.backgroundColor = [UIColor whiteColor];
    [UIView viewShadowColor:backgroundView];
    [self.view addSubview:backgroundView];
    
    UIView *gradientView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, backgroundView.size.width, backgroundView.size.height - 70)];
    [UIView viewRediusForLeftAndReightOfTop:gradientView withRedius:15];
    [backgroundView addSubview:gradientView];
    
    //初始化渐变层
    self.gradientLayer = [CAGradientLayer layer];
    self.gradientLayer.frame = gradientView.bounds;
    [gradientView.layer addSublayer:self.gradientLayer];
    
    //设置渐变颜色方向
    self.gradientLayer.startPoint = CGPointMake(0, 0);
    self.gradientLayer.endPoint = CGPointMake(1, 1);
    
    //设定颜色组
    self.gradientLayer.colors = @[(__bridge id)kGradientStart.CGColor,
                                  (__bridge id)kGradientEnd.CGColor];
    
    //设定颜色分割点
    self.gradientLayer.locations = @[@(0.3f) ,@(1.0f)];
    
    UILabel *arts1Label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, gradientView.size.width, gradientView.size.height)];
    arts1Label.text = @"Arts1";
    arts1Label.font = [UIFont boldSystemFontOfSize:48];
    arts1Label.textColor = [UIColor whiteColor];
    [arts1Label setTextAlignment:(NSTextAlignmentCenter)];
    arts1Label.layer.shadowColor = [UIColor whiteColor].CGColor;
    arts1Label.layer.shadowOffset = CGSizeMake(3, 3);
    arts1Label.layer.shadowRadius = 5;
    [gradientView addSubview:arts1Label];
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
